﻿/*
 * Created by SharpDevelop.
 * User: StrunevskyDV
 * Date: 03.03.2010
 * Time: 16:19
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.ComponentModel;
using EmailJabber.Entities.Entities;

namespace FinancialPersonal.Entities
{
	/// <summary>
	/// Description of RepeatedOutcomeEntity.
	/// </summary>
	public class RepeatedOutcomeEntity:EntityBase
	{
		public RepeatedOutcomeEntity()
		{
			Id = Guid.NewGuid();
		}
		public bool Active{get;set;}
		public Guid UserId{get;set;}
		public string Description{get;set;}
		public Decimal Value{get;set;}
		public int RepeatPeriod{get;set;}
		public DateTime LastPayment{get;set;}
		
		public decimal MoneyPerMonth
		{
			get
			{
				if(!Active)return 0;
				
				if(RepeatPeriod>0)
				{
					return Value / RepeatPeriod;
				}
				else
				{
					return 0;
				}
			}
		}
		
		public decimal MoneyNow
		{
			get{
				if(!Active)return 0;
				return (MoneyPerMonth * monthDifference(DateTime.Now,LastPayment));
			}
		}
	}
}
